package com.yatb.trac.controller;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.springframework.web.servlet.ModelAndView;
import org.springframework.web.servlet.mvc.AbstractController;

import com.yatb.trac.pojo.Tickets;
import com.yatb.trac.pojo.Utenti;
import com.yatb.trac.service.SearchService;
import com.yatb.trac.util.Browser;

public class ListaUtentiController extends AbstractController {

	private SearchService searchService;
	private Browser browser;
	@Override
	protected ModelAndView handleRequestInternal(HttpServletRequest request,
			HttpServletResponse response) throws Exception {
		Page thePage = getBrowser().impaginaRicerca(request, null, Utenti.class);

		Utenti[] utentis = getSearchService().find(new Utenti[0], thePage.getFirstRecord(), Utenti.class);
		request.getSession(false).setAttribute("listaUtenti", utentis);
		ModelAndView modelAndView = new ModelAndView();
		modelAndView.setViewName("listaUtenti");
		return modelAndView;
	}
	public SearchService getSearchService() {
		return searchService;
	}
	public void setSearchService(SearchService searchService) {
		this.searchService = searchService;
	}
	public Browser getBrowser() {
		return browser;
	}
	public void setBrowser(Browser browser) {
		this.browser = browser;
	}

}
